#ifndef __STORMWIDGET_CONFIGMANAGE_CPARSECONFIG_PARSECONFIG_H
#define __STORMWIDGET_CONFIGMANAGE_CPARSECONFIG_PARSECONFIG_H

#include "CommonDefine.h"
#include "MaterialInfo.h"
#import <msxml3.dll>
#include <vector>
//#include <pair>

class CParseConfig
{
public:
	CParseConfig(void);
	virtual ~CParseConfig(void);
	//UINT GetNodeCount(CStdString strPath);
	//BOOL GetNodeInfomation(CStdString strPath,UINT nIndex,CMaterialInfo& strInfo);
	BOOL GetNodeAttribute(CStdString strPath,UINT nIndex,CStdString strName,CStdString& strValue);
	//BOOL SetNodeAttribute(CStdString strPath,UINT nIndex,CStdString strName,CStdString strValue);
	BOOL SetNodeAttribute(CStdString strPath,CStdString strID,CStdString strValue);
	//BOOL SetNodeAttribute(CStdString strPath,std::vector<CStdString> vNo,CStdString strValue);

	UINT GetTypeCount(CStdString strPath);
	UINT GetNodeContByType(CStdString strPath,CStdString TypeName);
	//BOOL GetTypeName(UINT nIndex,CStdString& strValue);
	BOOL GetNodeInfomation(CStdString strPath,UINT nIndex,CStdString TypeName,CMaterialInfo& strInfo);
	CStdString GetTypeName(UINT nIndex);
	int GetTypeShowNode(CStdString strTypeName);
private:
	//BOOL Load(CStdString strPath);
	void ConstructInfo(CStdString strName,CStdString strValue,CMaterialInfo& strInfo);
	BOOL Save(CStdString strPath);
	BOOL Open(MSXML2::IXMLDOMDocument** ppDoc);
//private:
	//std::map<CStdString,int> m_mTypeNumber;
	std::vector<std::pair<CStdString,int>> m_mTypeNumber;
};


#define BeginEnumChildren(pNode,pSubNode) \
{MSXML2::IXMLDOMNodeListPtr spElements = pNode->selectNodes(_T("*")); \
	for (int i = 0; i < spElements->length; i++) \
{ \
	MSXML2::IXMLDOMNodePtr pSubNode = spElements->nextNode(); \
	if (pSubNode) \
{ 

#define EndEnumChildren() }}}

#endif //__STORMWIDGET_CONFIGMANAGE_CPARSECONFIG_PARSECONFIG_H
